Online Type-Directed Partial Evaluation for Dynamically-Typed Languages∗

نویسندگان

  • Eijiro Sumii
  • Naoki Kobayashi
چکیده

This article presents an alternative method of type-directed partial evaluation, which is simpler and more efficient than previous methods. Unlike previous methods, it is straightforwardly applicable to functional languages with various powerful type systems. As an extreme instance, this article mainly deals with a dynamically-typed functional language like Scheme. The key idea is to extend primitive value destructors such as function application and pair destruction (car and cdr), so that they generate residual code when their operands are dynamic. It unnecessitates an operation in type-directed partial evaluation called reflection, which was the major cause of complication and inefficiency in previous methods. We formalize our method as an extension of two-level λ-calculus, and prove it correct. Furthermore, we show that our type-directed partial evaluator can be derived from a simple online syntax-directed partial evaluator with higher-order abstract syntax, by the same transformation as an offline program-generatorgenerator (cogen) is derived from an offline syntax-directed partial evaluator. This clarifies why type-directed partial evaluation is faster than ordinary syntax-directed partial evaluation, and implies that we can obtain more powerful partial evaluators by replacing the underlying syntax-directed partial evaluator with more sophisticated ones.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Higher-Order Program Generation

This dissertation addresses the challenges of embedding programming languages, specializing generic programs to specific parameters, and generating specialized instances of programs directly as executable code. Our main tools are higher-order programming techniques and automatic program generation. It is our thesis that they synergize well in the development of customizable software. Recent res...

متن کامل

Deriving a Statically Typed Type-Directed Partial Evaluator

Type-directed partial evaluation was originally implemented in Scheme, a dynamically typed language. It has also been implemented in ML, a statically Hindley-Milner typed language. This note shows how the latter implementation can be derived from the former through a functional representation of inductively de ned types.

متن کامل

Scala.js: Type-Directed Interoperability with Dynamically Typed Languages

Interoperability between statically typed and dynamically typed languages is increasingly important, as can be witnessed by the many statically typed languages targeting JavaScript. Interoperating with both the object-oriented and functional features of JavaScript is essential, if only to manipulate the DOM, yet existing languages have very poor support for this. We present Scala.js, a dialect ...

متن کامل

Pragmatic Aspects of Type-Directed Partial Evaluation

Type-directed partial evaluation stems from the residualization of static values in dynamic contexts, given their type and the type of their free variables. Its algorithm coincides with the algorithm for coercing a subtype value into a supertype value, which itself coincides with Berger and Schwichtenberg’s normalization algorithm for the simply typed λ-calculus. Type-directed partial evaluatio...

متن کامل

A Simple Take on Typed Abstract Syntax in Haskell-like Languages

We present a simple way to program typed abstract syntax in a language following a Hindley-Milner typing discipline, such as Haskell and ML, and we apply it to automate two proofs about normalization functions as embodied in type-directed partial evaluation for the simply typed lambda calculus: normalization functions (1) preserve types and (2) yield long beta-eta normal forms.

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1999